package animal;

public class AnimalTest {
    public static void main(String[] args) {
        Animal[] animals = new Animal[3];
        animals[0] = new Dog("Buddy", 3, "Golden Retriever");
        animals[1] = new Cat("Whiskers", 2, "Orange");
        animals[2] = new Dog("Max", 5, "Labrador");

        for (Animal animal : animals) {
            System.out.println("\nAnimal: " + animal.getName() + ", Age: " + animal.getAge());
            animal.makeSound();
            
            if (animal instanceof Trainable) {
                ((Trainable) animal).train();
            }
            
            if (animal instanceof Swimmable) {
                ((Swimmable) animal).swim();
            }
        }
    }
}
